package com.lr.excel.utils;

import com.alibaba.excel.EasyExcel;
import com.lr.excel.entity.ExcelData;
import com.lr.excel.listener.SplitExcelIntoMultipleSheetListener;

/**
 * @author liurui
 * @ad Java一对一辅导，手把手带你拿高薪！
 * @WeChat：liuliang70
 * @date 2024/6/14 19:25
 */
public class EasyExcelUtils {

    private static void splitExcelIntoMultipleSheets() {
        String excelFilePath = "million_rows_data.xlsx";
        long startTime = System.currentTimeMillis();
        EasyExcel.read(excelFilePath, ExcelData.class, new SplitExcelIntoMultipleSheetListener()).sheet().doRead();
        System.out.println("导入100万条数据到MySQL所需时间：" + (System.currentTimeMillis() - startTime) / 1000 + "s");
    }

    public static void main(String[] args) {
        splitExcelIntoMultipleSheets();
    }

}
